package com.bestcem.xm.user.constant;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;

/**
 * 用户缓存-Key
 *
 * @author wangyunyun <yunyun.wang@idiaoyan.com>
 * @version v1.0
 * @date 2022/3/1 14:30
 */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class UserCacheKeyConstant {

    /**
     * 用户注册信息: {user_register_info}:{session_id}
     */
    public static final String REGISTER_INFO_AND_SESSION_ID = "user_register_info:{0}";

    /**
     * 用户token版本: USER:token_version:{user_id}
     */
    public static final String USER_TOKEN_VERSION = "USER:token_version:{0}";

    /**
     * 套餐消费数据
     */
    public static final String USER_PACK_CONSUMPTION = "USER:pack_consumption_";

    /**
     * oa相关
     */
    public static final String OA_TOKEN_KEY = "USER:OA";

    /**
     * 验证码相关
     */
    public static final String FIND_PWD_KEY = "USER:find_pwd:";

    /**
     * jwt token失效白名单相关
     */
    public static final String BLACK_TOKEN = "AUTH:token:black:{0}";

    /**
     * 联合登录用户锁相关
     */
    public static final String WJW_LOCK_KEY = "user:{0}";

    /**
     * 重置密码相关V3
     */
    public static final String RESET_TOKEN_KEY = "User:rstpwd_token_prefix_v3{0}";

    /**
     * 重置密码相关
     */
    public static final String RESET_PASSWORD_TOKEN_KEY = "User:rstpwd_token_{0}";

    /**
     * 用户注册验证码key: USER:free_register:{mobile}
     */
    public static final String FREE_REGISTER_PHONE_VCODE = "USER:free_register:{0}";

    /**
     * 用户快速登录验证码key: USER:fast_login:{mobile}
     */
    public static final String USER_FAST_LOGIN_PHONE_VCODE = "USER:fast_login:{0}";

    /**
     * 用户BIZ验证码key: USER:biz:{mobile}
     */
    public static final String USER_BIZ_PHONE_VCODE = "USER:biz:{0}";

    /**
     * 用户快速登录session_id key: {fast_token_prefix}:{session_id}
     */
    public static final String USER_FAST_TOKEN = "fast_token:{0}";

    /**
     * 用户是否锁定状态: USER:FAILED_LOGIN_LOCKED:{}:{}:{}:{} org_code、username、mobile、email
     */
    public static final String USER_LOCKED_FLAG = "USER:FAILED_LOGIN_LOCKED:{0}:{1}:{2}:{3}";

    /**
     * 用戶登录失败次数：USER:FAILED_LOGIN_LOCKED:{}:{}:{}:{} org_code、username、mobile、email
     */
    public static final String USER_FAILED_LOGIN_COUNT = "USER:FAILED_LOGIN_COUNT:{0}:{1}:{2}:{3}";

    /**
     * 绑定邮件前缀
     */
    public static final String BIND_EMAIL_PREFIX = "User:bind_email_";

    /**
     * 激活邮件token前缀
     */
    public static final String ACTIVATE_TOKEN_PREFIX = "User:activate_token_";

    /**
     * 绑定手机号前缀
     */
    public static final String BIND_MOBILE_PREFIX = "USER:mobile_bind:";

    /**
     * 登录失败次数 AUTH:LOGIN_CAPTCHA_COUNT:{user_name}:{ip}
     */
    public static final String LOGIN_CAPTCHA_COUNT = "AUTH:LOGIN_CAPTCHA_COUNT:{0}:{1}";

    /**
     * 图形验证码 img_captcha_{key}
     */
    public static final String LOGIN_IMG_CAPTCHA = "img_captcha_{0}";

    /**
     * 快速登录注册 {fast_create_user_prefix}:{session_id}
     */
    public static final String REGISTER_FAST_CREATE_USER = "fast_create_user:{0}";

    /**
     * 快速登录注册 USER:PRE_CREATE_{demo_org_code}
     */
    public static final String USER_PRE_CREATE_DEMO_ORG_CODE = "USER:PRE_CREATE_{0}";

    /**
     * 问卷网登录的公司列表
     */
    public static final String WENJUAN_LOGIN_ORG_LIST = "wjw_login_org_list:{0}";

    /**
     * 公司code seq
     */
    public static final String ORG_CODE_SEQ = "__org_code__";

    /**
     * 用户信息key
     */
    public static final String USER_INFO = "custom:get_user_info:%s:%s";

    /**
     * 企业微信
     */
    public static final String WXWORK_MINI_SESSION_PREFIX = "wxwork_mini_session";

    /**
     * 真实租户
     */
    public static final String OM_ORDER_EMAIL_CONF_REAL = "xm:om:order:conf:real";

    /**
     * 内部测试租户
     */
    public static final String OM_ORDER_EMAIL_CONF_TEST = "xm:om:order:conf:test";

    /**
     * 激活邮件token过期时间
     */
    public static final int USER_TOKEN_TIMEOUT = 2 * 3600;

    /**
     * 组织seq: group_seq_{org_id}
     */
    public static final String USER_GROUP_SEQ = "group_seq_{0}";

    /**
     * MFA手机验证码缓存key
     */
    public static final String USER_MFA_SMS_PREFIX = "USER:mfa_sms_vcode:{0}";

    /**
     * MFA邮箱验证码缓存key
     */
    public static final String USER_MFA_EMAIL_PREFIX = "USER:mfa_email_vcode:{0}";

    /**
     * MFA未绑定账号数缓存key
     */
    public static final String USER_MFA_CHECK_BIND = "USER:org_contact_{0}:{1}";

    /**
     * MFA是否允许跳过缓存key
     */
    public static final String USER_MFA_SKIP_PREFIX = "USER:skip_mfa:{0}";

    /**
     * 用户组织层级锁定状态
     */
    public static final String USER_GROUP_LEVEL_LOCK_KEY = "user:group:level:lock:%s";

    /**
     * 用户组织层级全局版本号
     */
    public static final String USER_GROUP_LEVEL_VERSION = "user:group:level:version:%s";

    /**
     * 手机端白皮书预约短信验证码
     */
    public static final String USER_WHITEPAPER_SUBSCRIBE_VCODE = "USER:whitepaper_subscribe:%s";

    /**
     * 使用场景列表缓存key
     */
    public static final String USER_SCENARIO_LIST_KEY="USER:scenario_list";

    /**
     * 获取订单状态lock key
     */
    public static final String USER_ORDER_STATUS_LOCK_KEY = "user:order:status:lock:%s";

    /**
     * 用户组织层级锁定状态
     */
    public static final String USER_UPLOAD_LOCK_KEY = "user:upload:lock:%s";
}
